<template>
  <el-form-item label="最小值">
    <el-input-number v-model="state.activeData.min" placeholder="最小值" />
  </el-form-item>
  <el-form-item label="最大值">
    <el-input-number v-model="state.activeData.max" placeholder="最大值" />
  </el-form-item>
  <el-form-item label="步长">
    <el-input-number v-model="state.activeData.step" placeholder="步数" />
  </el-form-item>
  <el-form-item v-if="['el-input-number'].includes(state.activeData._config_.tag)" label="精度">
    <el-input-number v-model="state.activeData.precision" :min="0" placeholder="精度" />
  </el-form-item>
  <el-form-item v-if="['el-input-number'].includes(state.activeData._config_.tag)" label="是否显示按钮">
    <el-switch v-model="state.activeData.controls" placeholder="是否显示按钮" />
  </el-form-item>
  <el-form-item v-if="['el-input-number'].includes(state.activeData._config_.tag)" label="按钮位置">
    <el-radio-group v-model="state.activeData['controls-position']">
      <el-radio-button value>默认</el-radio-button>
      <el-radio-button value="right">右侧</el-radio-button>
    </el-radio-group>
  </el-form-item>
  <el-form-item label="严格步数">
    <el-switch v-model="state.activeData['step-strictly']" />
  </el-form-item>
</template>
<script lang="ts" setup name="GoodInputNumber">
import { reactive } from "vue";
const props = defineProps({
  activeData: {
    type: Object,
    default: null
  }
});
const state = reactive({
  activeData: {} as any
});
const propsData = toRef(props);
state.activeData = propsData.value.activeData;
const emits = defineEmits(["updateActiveData"]);
watch(
  () => state.activeData,
  val => {
    emits("updateActiveData", val);
  }
);
</script>
